From 795972d0a4ad90e1871b86a27e1b3e255c18b2da Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Sun, 11 Sep 2005 09:28:21 +0000 Subject: [PATCH] An FC4/i386 install inside VMX on an x86_64 system fails because byte size is not handled by __set_reg_value. This patch adds that support. This patch also reindents Chengyuan Li cmpb patch so that is aligns with the rest of the code in that block. Signed-Off-By: Leendert van Doorn --- xen/arch/x86/vmx_io.c | 4 ++-- xen/arch/x86/vmx_platform.c | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/vmx_io.c b/xen/arch/x86/vmx_io.c index 7f33a6ef28..2aaf629865 100644 --- a/xen/arch/x86/vmx_io.c +++ b/xen/arch/x86/vmx_io.c @@ -99,7 +99,6 @@ static void set_reg_value (int size, int index, int seg, struct cpu_user_regs *r printk("Error: size:%x, index:%x are invalid!\n", size, index); domain_crash_synchronous(); break; - } break; case WORD: @@ -199,6 +198,7 @@ void load_cpu_user_regs(struct cpu_user_regs *regs) static inline void __set_reg_value(unsigned long *reg, int size, long value) { switch (size) { + case BYTE: case BYTE_64: *reg &= ~0xFF; *reg |= (value & 0xFF); @@ -215,7 +215,7 @@ static inline void __set_reg_value(unsigned long *reg, int size, long value) *reg = value; break; default: - printk("Error: <__set_reg_value> : Unknown size for register\n"); + printk("Error: <__set_reg_value>: size:%x is invalid\n", size); domain_crash_synchronous(); } } diff --git a/xen/arch/x86/vmx_platform.c b/xen/arch/x86/vmx_platform.c index fa3173b9b7..46f465c4cb 100644 --- a/xen/arch/x86/vmx_platform.c +++ b/xen/arch/x86/vmx_platform.c @@ -55,6 +55,7 @@ void store_cpu_user_regs(struct cpu_user_regs *regs) static inline long __get_reg_value(unsigned long reg, int size) { switch(size) { + case BYTE: case BYTE_64: return (char)(reg & 0xFF); case WORD: @@ -430,10 +431,10 @@ static int vmx_decode(unsigned char *opcode, struct instruction *instr) if (((opcode[1] >> 3) & 7) == 7) { /* cmp $imm, m32/16 */ instr->instr = INSTR_CMP; - if (opcode[0] == 0x80) - GET_OP_SIZE_FOR_BYTE(instr->op_size); - else - GET_OP_SIZE_FOR_NONEBYTE(instr->op_size); + if (opcode[0] == 0x80) + GET_OP_SIZE_FOR_BYTE(instr->op_size); + else + GET_OP_SIZE_FOR_NONEBYTE(instr->op_size); instr->operand[0] = mk_operand(instr->op_size, 0, 0, IMMEDIATE); instr->immediate = get_immediate(vm86, opcode+1, BYTE); -- 2.30.2